package cn.itsource.fallback;

import cn.itsource.openfeign.DriverSummaryOpenFeign;
import cn.itsource.result.JSONResult;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @program fccar_tt
 * @Description
 * @Author TT
 * @Date 2024/09/04 17:41
 * @Version 1.0
 */
@Component
public class DriverSummaryOpenFeignFallbackFactory implements FallbackFactory<DriverSummaryOpenFeign> {
    @Override
    public DriverSummaryOpenFeign create(Throwable cause) {
        return new DriverSummaryOpenFeign() {
            @Override
            public JSONResult updateDriverSummery(Long diverId) {
                return JSONResult.error(cause.getMessage());
            }

            @Override
            public JSONResult getDriverSummaryInfo() {
                return JSONResult.error(cause.getMessage());
            }

        };
    }
}
